// 2104.[滑窗] Puck收香蕉  https://oj.rnd.huawei.com/problems/2104/details
// 最少需要联系的供应商数量, 【要求连续的供应商】
// 供应商个数n, 需要收target
//输入 6 7
// 2 3 1 2 4 3
//输出,从下标为5和6的供应商处采购可满足要求。
// 2
//输入 8 11
// 1 1 1 1 1 1 1 1
//输出 0

#include <iostream>
#include <string>
#include <vector>
using namespace std;

// [L,R]
static int BuyBanana(int target, const vector<int>& vtStore) {
  if (vtStore.size() < 1 && target > 0) {
    return 0;
  }
  int nCurSum = 0;
  int minLen = vtStore.size() + 1;
  int left = 0;
  int right = 0;
  while (right < vtStore.size()) {
    nCurSum += vtStore[right];
    while (nCurSum >= target) {
      minLen = min(minLen, right - left + 1);
      nCurSum -= vtStore[left++];
    }
    right++;
  }
  return minLen <= vtStore.size() ? minLen : 0;
}

int main() {
  int num, target;
  while (cin >> num >> target) {
    vector<int> vtStore;
    for (int i = 0; i < num; i++) {
      int tmp;
      cin >> tmp;
      vtStore.push_back(tmp);
    }
    int nCount = BuyBanana(target, vtStore);
    printf("%d\n", nCount);
  }
  return 0;
}
